module.exports = {
  login: async (ctx) => {
    let user = ctx.request.body;
    console.log(user);
    if (user.username === 'admin' && user.password === '123') {
      ctx.session.user = user;
      ctx.state.data = { username: user.username };
    } else {
      ctx.state.error = '账号密码错误';
      ctx.state.code = -1;
    }
  },
  logout: (ctx) => {
    ctx.session = null;
    ctx.state.data = '注销登陆';
  },
};